package demo;

import java.util.Random;

public class CCCpractise {
    //开发验证码
    public static void main(String[] args) {
        String code=createCode(5);
        System.out.println(code);
    }
    public static String createCode(int n)
    {
        String code="";
        Random r=new Random();
        for (int i = 0; i < n; i++) {
            int type= r.nextInt(3);
            switch (type){
                case 0:
                    char ch=(char)(r.nextInt(26)+65);
                    code+=ch;
                    break;
                case 1:
                    char ch1=(char)(r.nextInt(26)+97);
                    code+=ch1;
                    break;
                case 2:
                    code+=r.nextInt(10);
                    break;
            }
        }
        return code;
    }

}
